package com.example.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author 王鹤蒲
 * @since 2023-10-07
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
@TableName("sys_operation_log")
@ApiModel(value = "OperationLog对象", description = "")
public class OperationLog implements Serializable {

  private static final long serialVersionUID = 1L;

  @ApiModelProperty("ID")
  @TableId(value = "id", type = IdType.AUTO)
  private Integer id;

  @ApiModelProperty("操作名称")
  private String operation;

  @ApiModelProperty("操作类型")
  private String type;

  @ApiModelProperty("请求方式")
  private String requestMethod;

  @ApiModelProperty("请求地址")
  private String operUrl;

  @ApiModelProperty("操作地址")
  private String ip;

  @ApiModelProperty("操作地点")
  private String location;

  @ApiModelProperty("操作名称")
  private String operator;

  @ApiModelProperty("方法名称")
  private String method;

  @ApiModelProperty("操作参数")
  private String operParam;

  @ApiModelProperty("操作结果")
  private String jsonResult;

  @ApiModelProperty("操作状态")
  private String status;

  @ApiModelProperty("执行时间")
  private String executionTime;


  @ApiModelProperty("起始时间")
  @TableField(exist = false)
  private String startTime;

  @ApiModelProperty("终止时间")
  @TableField(exist = false)
  private String endTime;

  @ApiModelProperty("操作时间")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  private LocalDateTime operationTime;


}
